home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWSemEvt / SLSemInt.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  13.6 KB  |  415 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLSemInt.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #define FW_OSemanticInterface_Class_Source
  11. #include "SLSemInt.xih"
  12.  
  13. #ifndef FWSOMENV_H
  14. #include "FWSOMEnv.h"
  15. #endif
  16.  
  17. //========================================================================================
  18. //    Runtime Informations
  19. //========================================================================================
  20.  
  21. #ifdef FW_BUILD_MAC    
  22. #pragma segment fwsemevt
  23. #endif
  24.  
  25. //========================================================================================
  26. //    class FW_OSemanticInterface
  27. //========================================================================================
  28.  
  29. //----------------------------------------------------------------------------------------
  30. //    FW_OSemanticInterface::InitODFSemanticInterface
  31. //----------------------------------------------------------------------------------------
  32.  
  33. SOM_Scope void  SOMLINK FW_OSemanticInterface__InitODFSemanticInterface(FW_OSemanticInterface *somSelf, 
  34.         Environment *ev,
  35.         ODPart* base,
  36.         ODSession* session,
  37.         FW_CSemanticInterface* semInt,
  38.         FW_HSemIntGlueProcs semIntGlue)
  39. {
  40.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  41.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__InitODFSemanticInterface");
  42.         
  43.     somThis->fGlueProcs = semIntGlue;
  44.     somThis->fSemanticInterface = semInt;
  45.  
  46.     somSelf->InitSemanticInterface(ev, base, session);
  47. }
  48.  
  49. //----------------------------------------------------------------------------------------
  50. //    FW_OSemanticInterface::somUninit
  51. //----------------------------------------------------------------------------------------
  52.  
  53. SOM_Scope void  SOMLINK FW_OSemanticInterface__somUninit(FW_OSemanticInterface *somSelf)
  54. {
  55.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  56.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__somUninit");
  57.         
  58.     FW_TRY
  59.     {
  60.         FW_SOMEnvironment ev;
  61.         somSelf->UsingPredispatchProc(ev, FALSE);
  62.     }
  63.     FW_CATCH_BEGIN
  64.     FW_CATCH_EVERYTHING()
  65.     {
  66.     }
  67.     FW_CATCH_END
  68.  
  69. //    FW_OSemanticInterface_parent_ODSemanticInterface_somUninit(somSelf);
  70. }
  71.  
  72. //----------------------------------------------------------------------------------------
  73. //    FW_OSemanticInterface::Release
  74. //----------------------------------------------------------------------------------------
  75.  
  76. SOM_Scope void  SOMLINK FW_OSemanticInterface__Release(FW_OSemanticInterface *somSelf, 
  77.     Environment *ev)
  78. {
  79.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  80.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__Release");
  81.  
  82.     FW_Boolean isValid = somSelf->IsValid(ev);
  83.     
  84.     FW_OSemanticInterface_parent_ODSemanticInterface_Release(somSelf,ev);
  85.         
  86.     if (!isValid && somSelf->GetRefCount(ev) == 0)
  87.         delete somSelf;
  88. }
  89.  
  90. //----------------------------------------------------------------------------------------
  91. //    FW_OSemanticInterface::CallEventHandler
  92. //----------------------------------------------------------------------------------------
  93.  
  94. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallEventHandler(FW_OSemanticInterface *somSelf, 
  95.         Environment *ev,
  96.         ODPart* thePart,
  97.         ODAppleEvent* theODAppleEvent,
  98.         ODAppleEvent* reply)
  99. {
  100. FW_UNUSED(thePart);
  101.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  102.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallEventHandler");
  103.     
  104.     FW_PlatformError error;
  105.     
  106.     if (somSelf->IsValid(ev))
  107.     {
  108.         error = CallUniversalProc(somThis->fGlueProcs->_fCallEventHandlerGlue, 
  109.             FW_uppCallEventHandlerProcInfo, ev, somThis->fSemanticInterface, 
  110.             theODAppleEvent, reply);
  111.     }
  112.     else
  113.         error = kODErrInvalidExtension;
  114.  
  115.     if (error != FW_xNoError)
  116.         FW_SetEvError(ev, error);
  117. }
  118.  
  119. //----------------------------------------------------------------------------------------
  120. //    FW_OSemanticInterface::CallCoercionHandler
  121. //----------------------------------------------------------------------------------------
  122.  
  123. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallCoercionHandler(FW_OSemanticInterface *somSelf, 
  124.         Environment *ev,
  125.         ODPart* thePart,
  126.         ODDesc* theODDesc,
  127.         ODDescType toType,
  128.         ODDesc* theResult)
  129. {
  130. FW_UNUSED(thePart);
  131.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  132.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallCoercionHandler");
  133.     
  134.     FW_PlatformError error;
  135.     
  136.     if (somSelf->IsValid(ev))
  137.     {
  138.         error = CallUniversalProc(somThis->fGlueProcs->_fCallCoercionHandlerGlue, 
  139.             FW_uppCallCoercionHandlerProcInfo, ev, somThis->fSemanticInterface, 
  140.             theODDesc, toType, theResult);
  141.     }
  142.     else
  143.         error = kODErrInvalidExtension;
  144.  
  145.     if (error != FW_xNoError)
  146.         FW_SetEvError(ev, error);
  147. }
  148.  
  149. //----------------------------------------------------------------------------------------
  150. //    FW_OSemanticInterface::CallPredispatchProc
  151. //----------------------------------------------------------------------------------------
  152.  
  153. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallPredispatchProc(FW_OSemanticInterface *somSelf, 
  154.         Environment *ev,
  155.         ODPart* thePart,
  156.         ODAppleEvent* theODAppleEvent,
  157.         ODAppleEvent* reply)
  158. {
  159. FW_UNUSED(thePart);
  160.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  161.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallPredispatchProc");
  162.  
  163.     FW_PlatformError error;
  164.     
  165.     if (somSelf->IsValid(ev))
  166.     {
  167.         error =  CallUniversalProc(somThis->fGlueProcs->_fCallPredispatchProcGlue, 
  168.             FW_uppCallPredispatchProcInfo, ev, somThis->fSemanticInterface, 
  169.             theODAppleEvent, reply);
  170.     }
  171.     else
  172.         error = kODErrInvalidExtension;
  173.  
  174.     if (error != FW_xNoError)
  175.         FW_SetEvError(ev, error);
  176. }
  177.  
  178. //----------------------------------------------------------------------------------------
  179. //    FW_OSemanticInterface::CallObjectAccessor
  180. //----------------------------------------------------------------------------------------
  181.  
  182. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallObjectAccessor(FW_OSemanticInterface *somSelf, 
  183.         Environment *ev,
  184.         ODPart* thePart,
  185.         ODDescType desiredClass,
  186.         ODOSLToken* container,
  187.         ODDescType containerClass,
  188.         ODDescType form,
  189.         ODDesc* selectionData,
  190.         ODOSLToken* value)
  191. {
  192. FW_UNUSED(thePart);
  193.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  194.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallObjectAccessor");
  195.  
  196.     FW_PlatformError error;
  197.     
  198.     if (somSelf->IsValid(ev))
  199.     {
  200.         error = CallUniversalProc(somThis->fGlueProcs->_fCallObjectAccessorGlue, 
  201.             FW_uppCallObjectAccessorProcInfo, ev, somThis->fSemanticInterface, 
  202.             desiredClass, container, containerClass, form, selectionData, value);
  203.     }
  204.     else
  205.         error = kODErrInvalidExtension;
  206.  
  207.     if (error != FW_xNoError)
  208.         FW_SetEvError(ev, error);
  209. }
  210.  
  211. //----------------------------------------------------------------------------------------
  212. //    FW_OSemanticInterface::CallCompareProc
  213. //----------------------------------------------------------------------------------------
  214.  
  215. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallCompareProc(FW_OSemanticInterface *somSelf, 
  216.         Environment *ev,
  217.         ODPart* thePart,
  218.         ODDescType oper,
  219.         ODOSLToken* obj1,
  220.         ODOSLToken* obj2,
  221.         ODBoolean* result)
  222. {
  223. FW_UNUSED(thePart);
  224.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  225.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallCompareProc");
  226.  
  227.     FW_PlatformError error;
  228.     
  229.     if (somSelf->IsValid(ev))
  230.     {
  231.         error = CallUniversalProc(somThis->fGlueProcs->_fCallCompareProcGlue, 
  232.             FW_uppCallCompareProcInfo, ev, somThis->fSemanticInterface, oper, obj1, obj2, result);
  233.     }
  234.     else
  235.         error = kODErrInvalidExtension;
  236.  
  237.     if (error != FW_xNoError)
  238.         FW_SetEvError(ev, error);
  239. }
  240.  
  241. //----------------------------------------------------------------------------------------
  242. //    FW_OSemanticInterface::CallCountProc
  243. //----------------------------------------------------------------------------------------
  244.  
  245. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallCountProc(FW_OSemanticInterface *somSelf, 
  246.         Environment *ev,
  247.         ODPart* thePart,
  248.         ODDescType desiredType,
  249.         ODDescType containerClass,
  250.         ODOSLToken* container,
  251.         ODSLong* result)
  252. {
  253. FW_UNUSED(thePart);
  254.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  255.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallCountProc");
  256.  
  257.     FW_PlatformError error;
  258.     
  259.     if (somSelf->IsValid(ev))
  260.     {
  261.         error = CallUniversalProc(somThis->fGlueProcs->_fCallCountProcGlue, 
  262.             FW_uppCallCountProcInfo, ev, somThis->fSemanticInterface, desiredType, 
  263.             containerClass, container, result);
  264.     }
  265.     else
  266.         error = kODErrInvalidExtension;
  267.  
  268.     if (error != FW_xNoError)
  269.         FW_SetEvError(ev, error);
  270. }
  271.  
  272. //----------------------------------------------------------------------------------------
  273. //    FW_OSemanticInterface::CallDisposeTokenProc
  274. //----------------------------------------------------------------------------------------
  275.  
  276. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallDisposeTokenProc(FW_OSemanticInterface *somSelf, 
  277.         Environment *ev,
  278.         ODPart* thePart,
  279.         ODOSLToken* unneededToken)
  280. {
  281. FW_UNUSED(thePart);
  282.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  283.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallDisposeTokenProc");
  284.  
  285.     FW_PlatformError error;
  286.     
  287.     if (somSelf->IsValid(ev))
  288.     {
  289.         error = CallUniversalProc(somThis->fGlueProcs->_fCallDisposeTokenProcGlue, 
  290.             FW_uppCallDisposeTokenProc, ev, somThis->fSemanticInterface, unneededToken);
  291.     }
  292.     else
  293.         error = kODErrInvalidExtension;
  294.  
  295.     if (error != FW_xNoError)
  296.         FW_SetEvError(ev, error);
  297. }
  298.  
  299. //----------------------------------------------------------------------------------------
  300. //    FW_OSemanticInterface::CallGetErrDescProc
  301. //----------------------------------------------------------------------------------------
  302.  
  303. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallGetErrDescProc(FW_OSemanticInterface *somSelf, 
  304.         Environment *ev,
  305.         ODPart* thePart,
  306.         ODDesc** errDesc)
  307. {
  308. FW_UNUSED(thePart);
  309.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  310.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallGetErrDescProc");
  311.  
  312.     FW_PlatformError error;
  313.     
  314.     if (somSelf->IsValid(ev))
  315.     {
  316.         error = CallUniversalProc(somThis->fGlueProcs->_fCallGetErrDescProcGlue, 
  317.             FW_uppCallGetErrDescProcInfo, ev, somThis->fSemanticInterface, errDesc);
  318.     }
  319.     else
  320.         error = kODErrInvalidExtension;
  321.  
  322.     if (error != FW_xNoError)
  323.         FW_SetEvError(ev, error);
  324. }
  325.  
  326. //----------------------------------------------------------------------------------------
  327. //    FW_OSemanticInterface::CallGetMarkTokenProc
  328. //----------------------------------------------------------------------------------------
  329.  
  330. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallGetMarkTokenProc(FW_OSemanticInterface *somSelf, 
  331.         Environment *ev,
  332.         ODPart* thePart,
  333.         ODOSLToken* dContainerToken,
  334.         ODDescType containerClass,
  335.         ODOSLToken* result)
  336. {
  337. FW_UNUSED(thePart);
  338.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  339.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallGetMarkTokenProc");
  340.  
  341.     FW_PlatformError error;
  342.     
  343.     if (somSelf->IsValid(ev))
  344.     {
  345.         error = CallUniversalProc(somThis->fGlueProcs->_fCallGetMarkTokenProcGlue, 
  346.             FW_uppCallGetMarkTokenProcInfo, ev, somThis->fSemanticInterface, dContainerToken, 
  347.             containerClass, result);
  348.     }
  349.     else
  350.         error = kODErrInvalidExtension;
  351.  
  352.     if (error != FW_xNoError)
  353.         FW_SetEvError(ev, error);
  354. }
  355.  
  356. //----------------------------------------------------------------------------------------
  357. //    FW_OSemanticInterface::CallMarkProc
  358. //----------------------------------------------------------------------------------------
  359.  
  360. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallMarkProc(FW_OSemanticInterface *somSelf, 
  361.         Environment *ev,
  362.         ODPart* thePart,
  363.         ODOSLToken* dToken,
  364.         ODOSLToken* markToken,
  365.         ODSLong index)
  366. {
  367. FW_UNUSED(thePart);
  368.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  369.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallMarkProc");
  370.  
  371.     FW_PlatformError error;
  372.     
  373.     if (somSelf->IsValid(ev))
  374.     {
  375.         error = CallUniversalProc(somThis->fGlueProcs->_fCallMarkProcGlue, 
  376.             FW_uppCallMarkProcInfo, ev, somThis->fSemanticInterface, dToken,
  377.             markToken, index);
  378.     }
  379.     else
  380.         error = kODErrInvalidExtension;
  381.  
  382.     if (error != FW_xNoError)
  383.         FW_SetEvError(ev, error);
  384. }
  385.  
  386. //----------------------------------------------------------------------------------------
  387. //    FW_OSemanticInterface::CallAdjustMarksProc
  388. //----------------------------------------------------------------------------------------
  389.  
  390. SOM_Scope void  SOMLINK FW_OSemanticInterface__CallAdjustMarksProc(FW_OSemanticInterface *somSelf, 
  391.         Environment *ev,
  392.         ODPart* thePart,
  393.         ODSLong newStart,
  394.         ODSLong newStop,
  395.         ODOSLToken* markToken)
  396. {
  397. FW_UNUSED(thePart);
  398.     FW_OSemanticInterfaceData *somThis = FW_OSemanticInterfaceGetData(somSelf);
  399.     FW_OSemanticInterfaceMethodDebug("FW_OSemanticInterface","FW_OSemanticInterface__CallAdjustMarksProc");
  400.  
  401.     FW_PlatformError error;
  402.     
  403.     if (somSelf->IsValid(ev))
  404.     {
  405.         error = CallUniversalProc(somThis->fGlueProcs->_fCallAdjustMarksProcGlue, 
  406.             FW_uppCallAdjustMarksProcInfo, ev, somThis->fSemanticInterface, newStart, 
  407.             newStop, markToken);
  408.     }
  409.     else
  410.         error = kODErrInvalidExtension;
  411.  
  412.     if (error != FW_xNoError)
  413.         FW_SetEvError(ev, error);
  414. }
  415.